package com.jzo2o.customer.controller.agency;

import com.jzo2o.common.model.Result;
import com.jzo2o.customer.model.dto.request.BankAccountUpsertReqDTO;
import com.jzo2o.customer.model.dto.response.BankAccountResDTO;
import com.jzo2o.customer.service.IBankAccountService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 银行账户相关接口
 *
 **/
@RestController("AgencyBankAccountController")
@RequestMapping("/agency/bank-account")
@Api(tags = "机构端 - 银行账户相关接口")
public class BankAccountController {

    @Autowired
    private IBankAccountService bankAccountService;
    /**
     * 新增或更新银行账号信息接口
     * 接口路径：POST /customer/agency/bank-account
     * 请求类型：application/json      （BankAccountUpsertReqDTO）
     */
    @PostMapping
    @ApiOperation("根据评价等级分页查询当前用户评价列表")
    public Result saveOrUpdateBankAccount(@RequestBody BankAccountUpsertReqDTO dto) {
        //调用service接口
        bankAccountService.saveOrUpdateBankAccount(dto);
        return Result.ok();
    }
    /**
     * 接口路径：GET /customer/worker/bank-account/currentUserBankAccount
     * 请求参数：无
     * 响应参数：BankAccountResDTO
     */
    @GetMapping("/currentUserBankAccount")
    @ApiOperation("获取当前用户的银行账户信息")
    public BankAccountResDTO getCurrentUserBankAccount() {
       return bankAccountService.getCurrentUserBankAccount();
    }
}
